import React, { Component, createContext } from 'react'
import { Consumer } from '../utils'

// const { Consumer } = createContext()

class Son extends Component {
    render() {
        return (
            <div>
                {/* Consumer中必须包裹一个函数 */}
                {/* 传递的数据在该函数的参数中 */}
                <Consumer>
                    {
                        (value) => {
                            return <h5>我是子组件 --- { value }</h5>
                        }
                    }
                </Consumer>
            </div>
        )
    }
}

export default Son